package com.huitongmaoyi.ai.entity;

import java.time.LocalDateTime;

public class Customer {
    private String id;
    private String name;
    private String countryCode; // 国家代码，如 "DE"
    private String city;
    private String industry;
    private Double annualOrderValue; // 万美元
    private Integer lastContactDays;
    private String contactPerson;
    private String email;
    private String phone;
    private String address;
    private String paymentTerms; // 付款方式
    private String creditRating; // A/B/C/D
    private Integer riskLevel;   // 1-5
    private String notes;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;

    // 构造函数（用于 DAO 创建）
    public Customer(String id, String name, String countryCode, String city,
                    String industry, Double annualOrderValue, Integer lastContactDays,
                    String contactPerson, String email, String phone, String address,
                    String paymentTerms, String creditRating, Integer riskLevel, String notes) {
        this.id = id;
        this.name = name;
        this.countryCode = countryCode;
        this.city = city;
        this.industry = industry;
        this.annualOrderValue = annualOrderValue;
        this.lastContactDays = lastContactDays;
        this.contactPerson = contactPerson;
        this.email = email;
        this.phone = phone;
        this.address = address;
        this.paymentTerms = paymentTerms;
        this.creditRating = creditRating;
        this.riskLevel = riskLevel;
        this.notes = notes;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public void setAnnualOrderValue(Double annualOrderValue) {
        this.annualOrderValue = annualOrderValue;
    }

    public void setCity(String city) {
        this.city = city;
    }

    public void setContactPerson(String contactPerson) {
        this.contactPerson = contactPerson;
    }

    public void setCountryCode(String countryCode) {
        this.countryCode = countryCode;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public void setCreditRating(String creditRating) {
        this.creditRating = creditRating;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setIndustry(String industry) {
        this.industry = industry;
    }

    public void setLastContactDays(Integer lastContactDays) {
        this.lastContactDays = lastContactDays;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public void setPaymentTerms(String paymentTerms) {
        this.paymentTerms = paymentTerms;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public void setRiskLevel(Integer riskLevel) {
        this.riskLevel = riskLevel;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    // Getters（按需可加 Setters）
    public String getId() { return id; }
    public String getName() { return name; }
    public String getCountryCode() { return countryCode; }
    public String getCity() { return city; }
    public String getIndustry() { return industry; }
    public Double getAnnualOrderValue() { return annualOrderValue; }
    public Integer getLastContactDays() { return lastContactDays; }
    public String getContactPerson() { return contactPerson; }
    public String getEmail() { return email; }
    public String getPhone() { return phone; }
    public String getAddress() { return address; }
    public String getPaymentTerms() { return paymentTerms; }
    public String getCreditRating() { return creditRating; }
    public Integer getRiskLevel() { return riskLevel; }
    public String getNotes() { return notes; }

    @Override
    public String toString() {
        return String.format(
                "ID: %-6s | 公司: %-20s | 国家: %-4s | 行业: %-12s | 年订单额: $%8.2f万 | 信用: %s | 风险: %d",
                id, name, countryCode, industry,
                annualOrderValue == null ? 0.0 : annualOrderValue,
                creditRating, riskLevel
        );
    }
}